package com.example.demo.encrypt;


import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.std.StringDeserializer;
import lombok.NoArgsConstructor;
import lombok.SneakyThrows;

import java.io.IOException;

/**
 * @program: mpf-mod-openapi-service
 * @description:
 * @author: zt22328 赵儒定
 * @create: 2022-07-07 16:04
 **/
@NoArgsConstructor
//@AllArgsConstructor
public class EncryptDeserializer extends StringDeserializer {

    public static String key;

    @Override
    @SneakyThrows
    public String deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
        return AESUtil.encrypt(super.deserialize(p, ctxt),key);
    }

}
